home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tcprogud.sit / TC Prog Guide / card_36702.txt < prev    next >
Text File  |  1991-02-27  |  1KB  |  26 lines

  1. -- card: 36702 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 4755
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 4
  9. ----- text -----
  10. Since it is derived from the Person class, the Student class implicitly declares age and weight instance variables as well.  It is necessary to redefine any inherited methods which were declared in the new class definition, for example:
  11.  
  12.     void    Student::set(void)
  13.     {
  14.         student_num = 12345;
  15.         inherited::set();              /* TC-only syntax */
  16.     }
  17.  
  18. The 'inherited::set()' syntax calls the set() method of the base class, which itself assigns values to the inherited age and weight instance variables.  This TC syntax is not available in C++; instead the 'Person::set()' call is required.
  19.  
  20. It is possible to derive additional classes from the Student class to obtain still more-specialized classes.  In fact, it is customary to derive ALL classes in an application from a single class and its descendants.  For the remainder of this chapter we will use the class Generic_Class as this "root" class:
  21.  
  22.  
  23.  
  24. -- part contents for background part 7
  25. ----- text -----
  26. 109